<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Freetype OpenGL: Documentation</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="style.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="content"><!-- do not remove this div! -->

<div id="top"><!-- do not remove this div! -->

  
  <div id="titlearea">
    
    <div id="projectname">Freetype OpenGL</div>
    
    
    <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
    
  </div>
  

<!--

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Freetype OpenGL
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
  </td>
  
  
  
   
  
 </tr>
 </tbody>
</table>
</div>
-->


<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript" src="dynsections.js"></script>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">Documentation </div>  </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#introduction">Introduction</a></li>
<li class="level1"><a href="#API">Application Programming Interface</a><ul><li class="level2"><a href="#mandatory">Mandatory</a></li>
<li class="level2"><a href="#optional">Optional</a></li>
</ul>
</li>
</ul>
</div>
<div class="textblock"><h2><a class="anchor" id="introduction"></a>
Introduction</h2>
<p>Freetype GL is a small library for displaying unicode text using a (single) vertex buffer and a single texture where necessary glyphs are tighly packed.</p>
<p><b>Example Usage</b>: </p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">   #include &quot;freetype-gl.h&quot;</span>

   ...

   <span class="comment">// Text to be printed</span>
   <span class="keywordtype">wchar_t</span> *text = L<span class="stringliteral">&quot;A Quick Brown Fox Jumps Over The Lazy Dog 0123456789&quot;</span>;

   <span class="comment">// Texture atlas to store individual glyphs</span>
   <a class="code" href="structtexture__atlas__t.html" title="A texture atlas is used to pack several small regions into a single texture.">texture_atlas_t</a> *atlas = <a class="code" href="group__texture-atlas.html#ga7769be70f630e0a8a8b320525a07382d" title="Creates a new empty texture atlas.">texture_atlas_new</a>( 512, 512, 1 );

   <span class="comment">// Build a new texture font from its description and size</span>
   <a class="code" href="structtexture__font__t.html" title="Texture font structure.">texture_font_t</a> *font = <a class="code" href="group__texture-font.html#ga904424e7b0e2be14b694599b5c483e64" title="This function creates a new texture font from given filename and size.">texture_font_new</a>( atlas, <span class="stringliteral">&quot;./Vera.ttf&quot;</span>, 16 );

   <span class="comment">// Build a new vertex buffer (position, texture &amp; color)</span>
   <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *buffer= <a class="code" href="group__vertex-buffer.html#ga309c1129a1028f251fe6e6c3c1534a42" title="Creates an empty vertex buffer.">vertex_buffer_new</a>( <span class="stringliteral">&quot;v3i:t2f:c4f&quot;</span> );

   <span class="comment">// Where to start printing on screen</span>
   <a class="code" href="unionvec2.html" title="Tuple of 2 floats.">vec2</a> pen = {0,0};

   <span class="comment">// Text color</span>
   <a class="code" href="unionvec4.html" title="Tuple of 4 floats.">vec4</a> black = {0,0,0,1};

   <span class="comment">// Add text to the buffer</span>
   add_text( buffer, font, <span class="stringliteral">&quot;Hello World !&quot;</span>, text, &amp;black, &amp;pen );

   ...

   <a class="code" href="group__vertex-buffer.html#ga48df5bafd9315aabfb7f14bedb778c16" title="Render vertex buffer.">vertex_buffer_render</a>( buffer, GL_TRIANGLES, <span class="stringliteral">&quot;vtc&quot;</span>);

   ...
</pre></div> <hr/>
 <h2><a class="anchor" id="API"></a>
Application Programming Interface</h2>
<p>The code is fairly simple and organized as follow:</p>
<h3><a class="anchor" id="mandatory"></a>
Mandatory</h3>
<p>These are the minimum set of structures and files that are required to load a font and pack glyphs into a texture.</p>
<ul>
<li><a class="el" href="group__vector.html">Vector</a><br/>
 This structure loosely mimics the std::vector class from c++.</li>
</ul>
<ul>
<li><a class="el" href="group__texture-atlas.html">Texture atlas</a><br/>
 Texture atlas is used to pack several small regions into a single texture.</li>
</ul>
<ul>
<li><a class="el" href="group__texture-font.html">Texture font</a><br/>
 The texture-font structure is in charge of creating bitmap glyphs and to upload them to a texture atlas.</li>
</ul>
<h3><a class="anchor" id="optional"></a>
Optional</h3>
<p>These are convenient stuctures and files that facilitate text rendering.</p>
<ul>
<li><a class="el" href="group__shader.html">Shader</a><br/>
 Shader loading/compiling/linking.</li>
</ul>
<ul>
<li><a class="el" href="group__vertex-buffer.html">Vertex buffer</a><br/>
 Generic vertex buffer structure inspired by pyglet (python).</li>
</ul>
<ul>
<li><a class="el" href="group__markup.html">Markup</a><br/>
 Simple structure that describes text properties.</li>
</ul>
<ul>
<li><a class="el" href="group__font-manager.html">Font manager</a><br/>
 Structure in charge of caching fonts.</li>
</ul>
<ul>
<li><a class="el" href="group__text-buffer.html">Text buffer</a><br/>
 Convenient structure for manipulating and rendering text. </li>
</ul>
</div></div><!-- contents -->
</div>
</body>
</html>
